﻿package org.net 
{
	import flash.events.*;
	import flash.events.ProgressEvent;
	import flash.media.Sound;
	import flash.net.URLRequest;
	import flash.errors.*
		
	import org.abcFrame.core.*;
	import org.net.*;
	import org.enmu.*;
	
	public class AbcRemote
	{
		private var path:String
		private var responder:AbcResponder
		
		public function AbcRemote(path:String,responder:AbcResponder):void
		{
			this.path=path
			this.responder=responder
			
			//var path = "http://localhost:8080/openamf/gateway"; 
			var service:Service = new Service(path, new Log(), "hello", null,null); 
			var mypc:PendingCall = service.getString(); 
			mypc.responder = new RelayResponder(this, "getString_Result", "getString_Fault"); 
		}
		
		function getString_Result(evt:ResultEvent):Void { 

			if(responder.onResult!=null)responder.onResult(evt.result,path);
			
		} 
		
		function getString_Fault(evt:FaultEvent):Void { 
			
			AbcEventDispatcher.instance.dispatcher(AbcEventType.REMOTEEVENT,"Error:"+path+evt.fault.__faultstring)
			
		} 
		
	}

}
